package com.mccken.eshop.common.utils;

import java.util.Objects;

import com.mccken.eshop.common.exception.BaseBizException;
import com.mccken.eshop.common.exception.CommonErrorCodeEnum;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * 参数校验工具类
 * 
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-08-28 16:37
 **/
@Slf4j
public class ParamCheckUtil {
	
	public static void checkStringNonEmpty(String s) throws BaseBizException {
		if (StrUtil.isBlank(s)) {
			throw new BaseBizException(CommonErrorCodeEnum.SERVER_ILLEGAL_ARGUMENT_ERROR);
		}
	}

	public static void checkObjectNonNull(Object o) {
		if (Objects.isNull(o)) {
			throw new BaseBizException(CommonErrorCodeEnum.SERVER_ILLEGAL_ARGUMENT_ERROR);
		}
	}
}
